/*
 * @lc app=leetcode.cn id=283 lang=javascript
 *
 * [283] 移动零
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @return {void} Do not return anything, modify nums in-place instead.
 */
var moveZeroes = function(nums) {
  let right = nums.length - 1;

  for (let i = 0; i < right; i++) {
    if (nums[i] === 0) {
      for (let j = i; j < right; j++) {
        nums[j] = nums[j + 1];
      }
      nums[right--] = 0;
      i--;
    }
  }
};
// @lc code=end

